/**

 * @author admin

 * 2014年7月5日

 */

package com.tmall.testgen.plugin.views.vo;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class ViewContentProvider implements IStructuredContentProvider,
ITreeContentProvider {

public void inputChanged(Viewer v, Object oldInput, Object newInput) {
}

public void dispose() {
}

public Object[] getElements(Object parent) {
// if (parent.equals(getViewSite())) {
// if (invisibleRoot == null){
// initialize();
// }
// return getChildren(invisibleRoot);
// }
return getChildren(parent);
}

public Object getParent(Object child) {
if (child instanceof TreeObject) {
	return ((TreeObject) child).getParent();
}
return null;
}

public Object[] getChildren(Object parent) {
if (parent instanceof TreeParent) {
	return ((TreeParent) parent).getChildren();
}
return new Object[0];
}

public boolean hasChildren(Object parent) {
if (parent instanceof TreeParent) {
	return ((TreeParent) parent).hasChildren();
}
return false;
}

}